package com.heeexy.example.controller;

import com.alibaba.fastjson.JSONObject;
import com.heeexy.example.entity.OperationLog;
import com.heeexy.example.service.OperationLogService;
import com.heeexy.example.util.CommonUtil;
import com.heeexy.example.util.OperLog;
import com.heeexy.example.util.constants.ErrorEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/operationLog")
public class OperationLogController {

    @Autowired
    OperationLogService operationLogService;

    /*
    * 根据账号Id查询日志
    * */
    @GetMapping("/findByStuUId/{uId}")
    public JSONObject findByStuUId(@PathVariable("uId") Integer uId){
        JSONObject byStuUId = operationLogService.findByStuUId(uId);
        return CommonUtil.successJson(byStuUId);
    }

    /*
    *新增日志
    * */
//    @PostMapping("/insert")
//    public JSONObject insert(OperationLog operationLog){
//        JSONObject insert = operationLogService.insert(operationLog);
//        if (insert==null){
//            return CommonUtil.successJson(ErrorEnum.E_10014);
//        }
//        return CommonUtil.successJson(ErrorEnum.E_10015);
//    }
}
